/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.bda.mediatheque.entities;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author samsung
 */
@Entity
@Table(name = "lignecommande")
@NamedQueries({
    @NamedQuery(name = "Lignecommande.findAll", query = "SELECT l FROM Lignecommande l")})
public class Lignecommande implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id @GeneratedValue(strategy=GenerationType.AUTO)
    @Basic(optional = false)
    @NotNull
    @Column(name = "ligneCommandeId")
    private Integer ligneCommandeId;
    @Column(name = "quantite")
    private Integer quantite;
    @Size(max = 45)
    @Column(name = "designationArticle")
    private String designationArticle;
    @JoinColumn(name = "bonCommande", referencedColumnName = "bonCommandeId")
    @ManyToOne(optional = false)
    private Boncommande bonCommande;

    public Lignecommande() {
    }

    public Lignecommande(Integer ligneCommandeId) {
        this.ligneCommandeId = ligneCommandeId;
    }

    public Integer getLigneCommandeId() {
        return ligneCommandeId;
    }

    public void setLigneCommandeId(Integer ligneCommandeId) {
        this.ligneCommandeId = ligneCommandeId;
    }

    public Integer getQuantite() {
        return quantite;
    }

    public void setQuantite(Integer quantite) {
        this.quantite = quantite;
    }

    public String getDesignationArticle() {
        return designationArticle;
    }

    public void setDesignationArticle(String designationArticle) {
        this.designationArticle = designationArticle;
    }

    public Boncommande getBonCommande() {
        return bonCommande;
    }

    public void setBonCommande(Boncommande bonCommande) {
        this.bonCommande = bonCommande;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (ligneCommandeId != null ? ligneCommandeId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Lignecommande)) {
            return false;
        }
        Lignecommande other = (Lignecommande) object;
        if ((this.ligneCommandeId == null && other.ligneCommandeId != null) || (this.ligneCommandeId != null && !this.ligneCommandeId.equals(other.ligneCommandeId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.bda.mediatheque.dao.Lignecommande[ ligneCommandeId=" + ligneCommandeId + " ]";
    }
    
}
